<?php
/**
 * home asset manager
 * when render page , used by asset filter
 * @package Home Libraries
 * @author luweijun <yiming_6weijun@163.com>
 * @copyright (c) YouKeTang 2013 
 */
class Home_Asset {
    
    /**
     * invoke style before route called
     * @param type $type
     */
    public static function invoke($type = 'header') {
        if (Laravel\URI::segment(1) == 'admin') return;
        
        if (is_callable("static::{$type}")) {
            static::$type();
        }

		$module = Laravel\URI::segment(1);
		if (is_callable("static::{$module}")) {
			static::$module();
		}
    }
    
    /**
     * home common css and scripts
     */
    private static function header() {
        Asset::container('header')->add('bootstrap', 'thirdparty/bootstrap/css/bootstrap.css');
        Asset::container('header')->add('core', 'home/css/core.css');
        Asset::container('header')->add('category', 'home/css/category.css');

        Asset::container('header')->add('plug', 'common/js/plug/plug.js');
        Asset::container('header')->add('bootstrap', 'thirdparty/bootstrap/js/bootstrap.min.js');
        Asset::container('req')->add('category', 'home/js/buss/category.js');
        Asset::container('req')->add('totop', 'home/js/ui/totop.js');
        if (!is_null(Laravel\URI::segment(1))) {
             Asset::container('req')->add('catslide', 'home/js/buss/catslide.js');
        }
    }

	/**
	 * video css and js
	 */
	private static function video() {
        Asset::container('header')->add('umsplayer', 'ums/js/umsplayer.js');
	}
    
    
}
